package com.aliyun.messagemgt.repository;

import com.aliyun.messagemgt.converter.SysPropertyConverter;
import com.aliyun.messagemgt.domain.repository.ISysPropertyRepository;
import com.aliyun.messagemgt.dto.sys.SysPropertyDTO;
import com.aliyun.messagemgt.entities.SysProperty;
import com.aliyun.messagemgt.repository.mappers.SysPropertyMapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 系统表-系统属性表 服务实现类
 * </p>
 *
 * @author wugongzi
 * @since 2021-10-15
 */
@Service
public class SysPropertyServiceMybatisRepository implements ISysPropertyRepository {

    @Autowired
    private SysPropertyMapper sysPropertyMapper;
    @Override
    public SysPropertyDTO getByPropertyCode(String propertyCode) {
        QueryWrapper<SysProperty> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("property_code",propertyCode);
        queryWrapper.eq("is_deleted","N");
        SysProperty sysProperty = sysPropertyMapper.selectOne(queryWrapper);
        SysPropertyDTO sysPropertyDTO = SysPropertyConverter.INSTANCE.sysProperty2sysPropertyDTO(sysProperty);
        return sysPropertyDTO;
    }
}
